#include "CursorWidget.h"
#include <QPainter>
#include <iostream>
#include <fstream>

using namespace std;

CursorWidget::CursorWidget(QWidget *parent ) : QWidget(parent)
{
	// give it some height, will be resized later
	this->resize(2, 200);
}

CursorWidget::~CursorWidget()
{
}

// gets triggered by the OS whenever the widget needs to be repainted
void CursorWidget::paintEvent( QPaintEvent* event)
{
	if (this->height() != parentWidget()->height()) 
	{
		this->resize(2, parentWidget()->height());
	}
	
	QPainter painter(this);
	
	//painter.setPen(Qt::blue);
	// fill widget with white bg
	// fillRect ( x, y, width, height, QColor )
    painter.fillRect( 0, 0, 2, this->height(), QColor("grey"));	
	
	// draw a middle line in blue
	//painter.drawLine( 0 , 0, 0, this->height());
	
}

QSize CursorWidget::sizeHint() const
{
    return this->size();
}
